package com.chance.cc.crawler.development.bootstrap.car;

import com.chance.cc.crawler.core.CrawlerEnum;
import com.chance.cc.crawler.core.filter.FilterUtils;
import com.chance.cc.crawler.core.record.CrawlerRequestRecord;
import com.chance.cc.crawler.development.controller.DevCrawlerController;

public class CarBootStrap {
    public static void main(String[] args) {
        seriesCar();
    }
    private static final String domain = "car";
    private static final String URL = "https://www.dongchedi.com/auto/series/1145";
    //采集轩逸日产品牌
    private static void seriesCar(){
        CrawlerRequestRecord requestRecord = CrawlerRequestRecord.builder()
                .startPageRequest(domain, CrawlerEnum.CrawlerRequestType.turnPage)
                .domain(domain)
                .httpUrl(URL)
                .filter(CrawlerEnum.CrawlerRecordFilter.dateRange)
                .addFilterInfo(FilterUtils.dateRangeFilterInfo(24*7,null))
                .releaseTime(System.currentTimeMillis())
                .build();
        requestRecord.tagsCreator().bizTags().addDomain(domain);//品牌存放的地址
        requestRecord.tagsCreator().bizTags().addCustomKV("brand","https://www.dongchedi.com/motor/pc/car/series/selected_series?city_name=?&series_ids=1145");

        DevCrawlerController.builder()
                .triggerInfo(domain,domain,System.currentTimeMillis(),domain)
                .crawlerRequestQueue(DevCrawlerController.devRequestQueue(domain))
                .consoleResultPipeline()
                .fileResultPipeline("D:\\chance\\log\\car.log",true)
                .requestRecord(requestRecord)
                .build()
                .start();
    }
}
